
/**
 * 获取分享商品图片地址
 */
function getGoodShare(goodUrl, headUrl, goodDetail, goodContent, success) {
  let param = new Object();
  param['path'] = goodUrl;
  param['headUrl'] = headUrl;
  param['goodDetail'] = goodDetail;
  param['goodContent'] = goodContent;
  wx.showLoading({
    title: '正在加载中',
  });
  getApp().func.Get(true, getApp().api.get_share_goods, param, 
  function(data) {
    wx.hideLoading();
    typeof success == "function" && success(data);
  },
  function (res) {
    wx.hideLoading();
    wx.showToast({
      title: res.data.message + '',
      duration: 2000,
      icon: 'none'
    })
  })
}

/**
 * 拼团分享图片
 */
function getGroupBuyShare(path, headUrl, goodDetail, goodContent, goodName, freeReceiveContent, success) {
  let param = new Object();
  param['path'] = path;
  param['headUrl'] = headUrl;
  param['goodDetail'] = goodDetail;
  param['goodContent'] = goodContent;
  param['goodName'] = goodName;
  param['freeReceiveContent'] = freeReceiveContent;
  wx.showLoading({
    title: '正在加载中',
  });
  getApp().func.Get(true, getApp().api.get_share_groupbuy, param, 
  function(data) {
    wx.hideLoading();
    typeof success == "function" && success(data);
  }, function(res) {
    wx.hideLoading();
    console.log(res.data.message);
  });
}

/**
 * 分享公众号
 */
function getOfficialAccounts (success) {
  getApp().func.Get(true, getApp().api.get_official_account, 
  function(data) {
    typeof success == "function" && success(data);
  },
  function(res) {
    console.log(res.data.message);
  });
}

/**
 * 开心果冻
 */
function getOfficialAccountGuide (success) {
  getApp().func.Get(true, getApp().api.get_official_account_guide, 
  function(data) {
    typeof success == "function" && success(data);
  },
  function (res){
    console.log(res.data.message);
  })
}

module.exports = {
  getGoodShare: getGoodShare,
  getGroupBuyShare: getGroupBuyShare,
  getOfficialAccounts: getOfficialAccounts,
  getOfficialAccountGuide: getOfficialAccountGuide
}